package base.interceptor.lib;

import java.util.Date;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
@SuppressWarnings("all")
public class SimpleInterceptor extends AbstractInterceptor {

    private String name;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String intercept(ActionInvocation action) throws Exception {
		System.out.println(name+"拦截器的动作开始执行的时间"+new Date());
		MethodAction info=(MethodAction)action.getAction();
		System.out.println(info);
		System.out.println("abcinfo:"+this.toString());
		long star=System.currentTimeMillis();
	  String result=action.invoke();
	 System.out.println(name+"拦截器的动作结束执行的时间"+new Date());
	 long end=System.currentTimeMillis();
	 System.out.println("result:"+result);
	 System.out.println("时间差为:"+(end-star));
		return result;
	}

}
